<?php

namespace app\controller;

use app\utils\DateTime;
use think\App;

class InternationController extends BlackController
{
    public function __construct(App $app)
    {
        parent::__construct($app);
    }

    public function formatSSR(){
        $param = $this->request->param();
        $airlines = 'NX';
//        $airlines = '*航司*';

        if ($param['card_type']=='NI'){
            $SSRCmd = "SSR FOID {$airlines} HK/NI {$param['id_card']}/p*序号*";
        }else{
            $SSRCmd = "SSR DOCS {$airlines} HK1 " . $param['card_type'] . '/' . $param['nationality'] . '/' . $param['id_card'] . '/' . $param['nationality'] . '/' .DateTime::d2m($param['birthday']) . '/' . ($param['sex'] == '男' ? 'M' : 'F') . '/' . DateTime::d2m($param['card_expiration']) . '/' . preg_replace('/,\s*/', '/', strtoupper($param['second_name'])) . '/p*序号*';
        }


        return $this->returnJson(strtoupper($SSRCmd));
    }
}